package com.shamrock.cms.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.shamrock.cms.dao.AuthoritiesDao;
import com.shamrock.cms.entity.Authorities;

public class AuthoritiesService {
	
	private AuthoritiesDao authoritiesDao;
	/**
	 * 获取总数
	 * @return
	 */
    public int getCount(){
    	return authoritiesDao.count();
    }
    /**
     * 删除
     * @param authorities
     * @return
     */
    public int delete(Authorities authorities){
    	return authoritiesDao.delete(authorities);
    }
    /**
     * 添加
     * @param authorities
     * @return
     */
    public int add(Authorities authorities){
    	return authoritiesDao.add(authorities);
    }
    /**
     * 获取所有记录
     * @return
     */
    public List<Authorities> getAllList(){
    	return authoritiesDao.getAllList();
    }
    /**
     * 通过role获取记录
     * @param role
     * @return
     */
    public Authorities getAuthoritiesByRole(String role){
    	return authoritiesDao.getAuthoritiesByRole(role);
    }
    /**
     * 通过url获取记录
     * @param role
     * @return
     */
    public List<Authorities> getAuthoritiesByResource(String url){
    	return authoritiesDao.getAuthoritiesByResource(url);
    }
    /**
     * 更新记录
     * @param authorities
     * @return
     */
    public int updateById(Authorities authorities){
    	return authoritiesDao.updateById(authorities);
    }
    /**
     * 通过role更新记录
     * @param role
     * @param authorities
     * @return
     */
    public int updateByRole(String role, Authorities authorities){
    	return authoritiesDao.updateByRole(role, authorities);
    }
}
